/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package domain;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author amega
 */
@Entity
@Table(name = "orderHall")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OrderHall.findAll", query = "SELECT o FROM OrderHall o"),
    @NamedQuery(name = "OrderHall.findById", query = "SELECT o FROM OrderHall o WHERE o.id = :id"),
    @NamedQuery(name = "OrderHall.findByDateOrder", query = "SELECT o FROM OrderHall o WHERE o.dateOrder = :dateOrder"),
    @NamedQuery(name = "OrderHall.findByCountPeople", query = "SELECT o FROM OrderHall o WHERE o.countPeople = :countPeople")})
public class OrderHall implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dateOrder")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateOrder;
    @Basic(optional = false)
    @NotNull
    @Column(name = "countPeople")
    private int countPeople;
    @JoinColumn(name = "idOrder", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Orders idOrder;
    @JoinColumn(name = "idHall", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Hall idHall;

    public OrderHall() {
    }

    public OrderHall(Integer id) {
        this.id = id;
    }

    public OrderHall(Integer id, Date dateOrder, int countPeople) {
        this.id = id;
        this.dateOrder = dateOrder;
        this.countPeople = countPeople;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDateOrder() {
        return dateOrder;
    }

    public void setDateOrder(Date dateOrder) {
        this.dateOrder = dateOrder;
    }

    public int getCountPeople() {
        return countPeople;
    }

    public void setCountPeople(int countPeople) {
        this.countPeople = countPeople;
    }

    public Orders getIdOrder() {
        return idOrder;
    }

    public void setIdOrder(Orders idOrder) {
        this.idOrder = idOrder;
    }

    public Hall getIdHall() {
        return idHall;
    }

    public void setIdHall(Hall idHall) {
        this.idHall = idHall;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OrderHall)) {
            return false;
        }
        OrderHall other = (OrderHall) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "domain.OrderHall[ id=" + id + " ]";
    }
    
}
